import {
	storage
} from "@/utils/index.js"

const state = {
	statusBar: storage('get', 'statusBar'),
	customBar: storage('get', 'customBar'),
	systemInfo: storage('get', 'systemInfo'),
}
const mutations = {
	SET_STATUS_BAR: (state, data) => {
		state.statusBar = data
		storage('set', 'statusBar', data)
	},
	SET_CUSTOM_BAR: (state, data) => {
		state.customBar = data
		storage('set', 'customBar', data)
	},
	SET_SYSTEM_INFO: (state, data) => {
		state.systemInfo = data
		storage('set', 'systemInfo', data)
	},
}
const actions = {
	/**
	 * 状态栏
	 */
	set_status_bar({
		commit
	}, data) {
		commit('SET_STATUS_BAR', data)
	},
	set_custom_bar({
		commit
	}, data) {
		commit('SET_CUSTOM_BAR', data)
	},
	set_system_info({
		commit
	}, data) {
		commit('SET_SYSTEM_INFO', data)
	},
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
